capture log close
capture noisily log using "R:\Zentrale\ZB-S\Daten_FDSZ_Gastforscher\1_gafo\2016_0133\Table 5.log", replace
capture noisily log using "Table 5.log", replace

*** Load data in Stata
clear all
set more off
set maxvar 5000

capture noisily use "final_sample_03032023_pseudo.dta", clear
capture noisily use "R:\Zentrale\ZB-S\Daten_FDSZ_Gastforscher\1_gafo\2016_0133\data\Bundesbank Discussion Paper\final_sample_03032023.dta", clear





*** Table 5, regressions
********************************************************************************

capture estimates drop _all

eststo r11: reghdfe lam100 c.sanctions if DEU_AbrImp_AbrNImp==0 & smallsample == 1, absorb(id) vce(cluster datum land)
distinct sysnr_num if e(sample)==1 // number of individual banks (not bank groups)

eststo r12: reghdfe lam100 c.sanctions if AbrImpFix==1 & smallsample == 1, absorb(id) vce(cluster datum land CTRY)
distinct sysnr_num if e(sample)==1 

eststo r13: reghdfe lam100 c.sanctions if AbrNimpFix==1 & smallsample == 1, absorb(id) vce(cluster datum land CTRY)
distinct sysnr_num if e(sample)==1

eststo r14: reghdfe lam100 c.sanctions if FImpFix==1 & smallsample == 1, absorb(id) vce(cluster datum land CTRY)
distinct sysnr_num if e(sample)==1

eststo r15: reghdfe lam100 c.sanctions if FNimpFix==1 & smallsample == 1, absorb(id) vce(cluster datum land CTRY)
distinct sysnr_num if e(sample)==1

eststo r16: reghdfe lam100 c.sanctions if nFImpFix==1 & smallsample == 1, absorb(id) vce(cluster datum land CTRY)
distinct sysnr_num if e(sample)==1

eststo r17: reghdfe lam100 c.sanctions if nFNimpFix==1 & smallsample == 1, absorb(id) vce(cluster datum land CTRY)
distinct sysnr_num if e(sample)==1

quietly estadd local systimeFE "No": _all
quietly estadd local id "Yes": _all


esttab r1* /// using "out.rtf"
	, append se unstack b(%10.3f) nogaps alignment(c) numbers /// 
	nobaselevels nodepvars noomitted noobs label /// 
	star(* 0.10 ** 0.05 *** 0.01) /// 
	scalars(systimeFE id "N Obs." "r2 R2" "r2_a adjR2") ///
	sfmt(%9.0f %9.0f %9.0f %9.2f %9.2f) ///
	title("Table 5") ///
	mtitles("DEU" "AbrImpFix" "AbrNimpFix" "FImpFix" "FNimpFix" "nFImpFix" "nFNimpFix") ///
	nonotes 

capture estimates drop _all

	
	
*** Table 5, coefficient comparison between (1) and (4) versus (6)
********************************************************************************	


gen temp = .
replace temp = 0 if nFImpFix==1 & smallsample == 1
replace temp = 1 if nFImpFix==0 | smallsample == 0

tab temp nFImpFix
tab temp smallsample
count

reghdfe lam100 sanctions c.sanctions#c.temp if (DEU_AbrImp_AbrNImp==0 & smallsample == 1) | temp==0, absorb(id) vce(cluster datum land CTRY)

reghdfe lam100 sanctions c.sanctions#c.temp if (FImpFix==1 & smallsample == 1) | temp==0, absorb(id) vce(cluster datum land CTRY)

* Note: the base effect of the variable temp is collinear with the id FEs.

log close

		








	
		













	
		